package com.mach.platform.util;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.NameFilter;
import com.alibaba.fastjson.serializer.PropertyFilter;

import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class U extends StrUtil{

	public static final ExecutorService cachedThreadPool = Executors.newCachedThreadPool();

//	public static void main(String[] argos){
//		Map<Object, String> map = new HashMap<Object, String>();
//		map.put(new Integer(1), "fuck");
//		
//		  PropertyFilter filter = new PropertyFilter() {
//
//		        public boolean apply(Object source, String name, Object value) {
//		            System.out.println("source=" + source + ",name="+ name + ",value="+ value);
//		            return true;
//		        }
//		    };
//		    NameFilter filter2 = new NameFilter(){
//				@Override
//				public String process(Object object, String name, Object value) {
//					System.out.println("source=" + object + ",name="+ name + ",value="+ value);
//					if(object instanceof Map){
//						Map<Object,Object> map = (Map)object;
//						if(map.size() > 0){
//							Set<Entry<Object, Object>> entrys = map.entrySet();
//							Object key = null;
//							for(Entry<Object,Object> entry : entrys){
//								key = entry.getKey();
//								break;
//							}
//							if(key instanceof Number){
//								//name = "'" + name + "'";
//							}
//						}
//					}
//					return name;
//				}};
//		
//		String json = JSON.toJSONString(map,filter2);
//		
//		System.out.println(json);
//	}


	public static boolean numInTang(double start, double end, Object data) {

		if(data instanceof Float){
			Float d = (Float)data;
			if(d > end)return false;
			if(d < start)return false;
		}
		if(data instanceof Integer){
			Integer d = (Integer)data;
			if(d > end)return false;
			if(d < start)return false;
		}
		if(data instanceof Long){
			Long d = (Long)data;
			if(d > end)return false;
			if(d < start)return false;
		}
		if(data instanceof Double){
			Double d = (Double)data;
			if(d > end)return false;
			if(d < start)return false;
		}
		if(data instanceof Short){
			Short d = (Short)data;
			if(d > end)return false;
			if(d < start)return false;
		}

		return true;

	}
}
